package org.gardenXml;

import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.logging.Logger;

public class TestMain {
    //log4J2使用
    private Logger logger = Logger.getLogger(TestMain.class.getName());
    @Test
    public void testMainObiect() {
        //加载spring配置文件，对象创建
        ApplicationContext context =
                new ClassPathXmlApplicationContext("bean.xml");
        //获取创建的对象
        Main main = (Main) context.getBean("main");
        System.out.println(main);
        //log4J2使用
        logger.info("main:"+main);
        //使用对象调用方法进行测试
        main.log();
    }

}
